const Koa = require('koa');
const router = require('koa-router')();
const render = require('koa-art-template');
const path = require('path');
const app = new Koa();
/* 引入子路由 */
const  admin = require('./routes/admin');
const api = require('./routes/api');
const index = require('./routes/index');
render(app, {
  root: path.join(__dirname, 'views'),
  extname: '.html', //后缀也可以写成.art
  debug: process.env.NODE_ENV !== 'production'
});
/* 配置子路由 */
/* 访问/admin时,使用admin路由模块去处理 */
router.use('/admin',admin)
router.use('/api',api);
router.use('/',index)
//启动路由
app.use(router.routes()).use(router.allowedMethods);
app.listen(8080)
